Difference degree evaluation device, difference degree evaluation method and program product

ABSTRACT

A difference degree evaluation device includes a signal acquisition unit which acquires at least two signals which are objects of matching, a memory unit which stores one of the two signals, which are acquired by the signal acquisition unit, as a reference signal, and stores the other of the two signals as an object signal, a sample extraction unit which extracts sample points in a predetermined block from the reference signal that is stored in the memory unit, and extracts sample points corresponding to the sample points of the reference signal from the object signal, and an arithmetic process unit which finds absolute difference values between the sample points of the reference signal and the sample points of the object signal, which are extracted by the sample extraction unit, and calculates a maximum value of the absolute difference values as an evaluation value.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is based upon and claims the benefit of priority fromprior Japanese Patent Application No. 2007-075316, filed Mar. 22, 2007,the entire contents of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a difference degree evaluation devicewhich is used, for example, for a search of corresponding points betweenimages, a difference degree evaluation method, and a program product.

2. Description of the Related Art

A search for corresponding points between a plurality of images isimportant in order to execute motion compensation, alignment and opticalflow estimation. General methods for the search for corresponding pointsare area-based matching methods such as template matching and blockmatching.

It is now assumed that one of two images, which are objects of matching,is called “reference image” and the other is called “object image”. Inthe template matching, a block of a predetermined size, which is set atan arbitrary position of the reference image, is used as a template, anda search is executed to find which position in the object imagecorresponds to each pixel in the template.

At this time, as a measure for evaluating the degree of matching, SSD(Sum of Squared Difference) or SAD (Sum of Absolute Difference) is used.The SSD and SAD indicate difference degrees. It is considered thatmatching is better as the evaluation value is lower. Jpn. Pat. Appln.KOKAI Publication No. 10-289315, for instance, discloses a matchingmethod using SSD.

The formal definitions of SSD and SAD are as follows:

$\begin{matrix}{{S\; S\;{D(d)}} = {\sum\limits_{p \in T}\left( {R_{p} - O_{p + d}} \right)^{2}}} & (1) \\{{S\; A\;{D(d)}} = {\sum\limits_{p \in T}{{R_{p} - O_{p + d}}}}} & (2)\end{matrix}$

In the equations (1) and (2), the pixel value at the coordinates p ofthe reference image is expressed as R_(p), and similarly the pixel valueat the coordinates p of the object image is expressed as O_(p). Symbol prepresents a position vector. If p=(px, py), an x component is px and ay component is py.

In addition, the set of coordinates of pixels, which constitute thetemplate, is T. For example, in the case where a rectangular block of16×16 pixels, whose upper left corner coordinates are (100, 200), isused as a template, the set T comprises the following 256 pixels.

T={(100, 200), (101, 200), . . . , (115, 200), (100, 201), (101, 201), .. . , (115, 201), . . . , (100, 215), (101, 215), . . . , (115, 215)}

In addition, parallel movement of coordinates in the object image fromthe reference image is expressed by a vector d. The SSD of equation (1)and the SAD of equation (2) are functions of d.

The SAD is advantageous in that the arithmetic operation is simple andthus the SAD can easily be implemented. However, a difference inbrightness occurs between images in the case where successivephotography is executed, for example, under a fluorescent lamp, or inthe case where images, which are photographed by using an optical systemwith high dimming characteristics, are mosaic-synthesized (e.g.synthesis of a panorama image).

In the case where images having such a difference in brightness are setas objects of matching, the robustness of matching will considerablydecrease in the SAD. The reason for this is that if the brightnesslevels of two images are sharply different, the absolute value operationbecomes meaningless, and the SAD becomes equivalent to a mere sum ofdifferences. In such a case, mean values of signals (DC components) aremerely compared, and matching of local irregularities can hardly beexecuted.

In order to make the explanation simple, one-dimensional signals, asshown in FIG. 15, are now exemplified.

Symbol a_(i) denotes a reference signal, and b_(i) denotes an objectsignal. Crest portions of the respective signals indicate correspondingparts. In this case, from the equation (2), SAD is expressed bySAD=Σ|a _(i) −b _(i)|  (3)

If the levels of a_(i) and b_(i) are greatly different, the equation (3)becomes equivalent to Σa_(i)−Σb_(i), and matching cannot be executed atany point, as shown in a comparison result in FIG. 17.

In the example of FIG. 17, four sample points are used as a template.The signal b_(i) is a signal to which a negative DC offset is applied,relative to a_(i), and is displaced from a_(i) by one sample. If thereis a level difference, the value of SAD becomes the same at any point(“4” in this example).

On the other hand, from the equation (1), the SSD is expressed bySSD=Σ(a _(i) −b _(i))²  (4)

The SSD is a measure which emphasizes the local peak property of adifference. Thus, even in the same situation, relatively robust matchingcan be executed. On the other hand, since the SSD is based on a squaringarithmetic operation, hardware for multiplication is needed and theprocessing speed is low. Moreover, in the multiplication result of theSSD, about double number of digits are generated, compared to absolutevalues used in the SAD. As a result, the circuit scale increases.

As has been described above, the SAD is easily to implement, but is notrobust to a level variation between signals. On the other hand, the SSDis relatively robust to a level variation between signals, but thecircuit scale increases.

SUMMARY OF THE INVENTION

According to an aspect of the present invention, there is provided adifference degree evaluation device comprising: a signal acquisitionunit which acquires at least two signals which are objects of matching;a memory unit which stores one of the two signals, which are acquired bythe signal acquisition unit, as a reference signal, and stores the otherof the two signals as an object signal; a sample extraction unit whichextracts sample points in a predetermined block from the referencesignal that is stored in the memory unit, and extracts sample pointscorresponding to the sample points of the reference signal from theobject signal; and an arithmetic process unit which finds absolutedifference values between the sample points of the reference signal andthe sample points of the object signal, which are extracted by thesample extraction unit, and calculates a maximum value of the absolutedifference values as an evaluation value.

According to another aspect of the present invention, there is provideda difference degree evaluation method comprising: acquiring at least twosignals which are objects of matching; storing one of the two signals asa reference signal in a predetermined memory, and storing the other ofthe two signals as an object signal in the memory; extracting samplepoints in a predetermined block from the reference signal that is storedin the memory, and extracting sample points corresponding to the samplepoints of the reference signal from the object signal; executing anarithmetic process of calculating, as an evaluation value, a maximumvalue of absolute difference values between the sample points of thereference signal and the sample points of the object signal; andevaluating a difference degree between the reference signal and theobject signal on the basis of the evaluation value which is calculatedby the arithmetic process.

According to still another aspect of the present invention, there isprovided a program product recorded in a computer readable recordingmedium and executed by a computer, comprising: acquiring at least twosignals which are objects of matching; storing one of the two signals asa reference signal in a predetermined memory, and storing the other ofthe two signals as an object signal in the memory; extracting samplepoints in a predetermined block from the reference signal that is storedin the memory, and extracting sample points corresponding to the samplepoints of the reference signal from the object signal; executing anarithmetic process of calculating, as an evaluation value, a maximumvalue of absolute difference values between the sample points of thereference signal and the sample points of the object signal; andevaluating a difference degree between the reference signal and theobject signal on the basis of the evaluation value which is calculatedby the arithmetic process.

Additional objects and advantages of the invention will be set forth inthe description which follows, and in part will be obvious from thedescription, or may be learned by practice of the invention. The objectsand advantages of the invention may be realized and obtained by means ofthe instrumentalities and combinations particularly pointed outhereinafter.

BRIEF DESCRIPTION OF THE DRAWING

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate embodiments of the invention, andtogether with the general description given above and the detaileddescription of the embodiments given below, serve to explain theprinciples of the invention.

FIG. 1A and FIG. 1B are perspective views showing an external structureof a digital camera in a case where a difference degree evaluationdevice according to a first embodiment of the present invention isapplied to the digital camera, FIG. 1A mainly showing a front-sidestructure, and FIG. 1B mainly showing a rear-side structure;

FIG. 2 is a block diagram showing an electronic circuit structure of thedigital camera according to the embodiment;

FIG. 3 is a block diagram showing a functional configuration of a CPUwhich is provided in the digital camera according to the embodiment;

FIG. 4 shows an example of matching between a reference image and anobject image in the embodiment;

FIG. 5 is a flow chart illustrating the flow of a main process of thedigital camera according to the embodiment;

FIG. 6 is a flow chart illustrating a process procedure of a functionmad, which is called from the main process of the digital camera in theembodiment;

FIG. 7 is a flow chart illustrating a process procedure of a functionsadplusmad, which is called from a main process of a digital cameraaccording to a second embodiment of the invention;

FIG. 8A and FIG. 8B are conceptual views for explaining area division ofa template in a third embodiment of the invention;

FIG. 9 is a flow chart illustrating a process procedure of a functionmaxsad, which is called from a main procedure of a digital cameraaccording to the third embodiment;

FIG. 10 is a block diagram showing a functional configuration of a CPUwhich is provided in a digital camera according to a fourth embodimentof the invention;

FIG. 11 is a flow chart illustrating a process in a case where MAD andSAD are selectively used in accordance with a level difference in thedigital camera according to the fourth embodiment;

FIG. 12 is a flow chart illustrating a process in a case where MAD andSAD are selectively used in accordance with a photography mode in thedigital camera according to the fourth embodiment;

FIG. 13 is a flow chart illustrating a process in a case where MAD ispreferentially used in a digital camera according to a fifth embodimentof the invention;

FIG. 14 is a flow chart illustrating a process in a case where SAD ispreferentially used in the digital camera according to the fifthembodiment;

FIG. 15 is a view for explaining a matching method in a case whereone-dimensional signals are exemplified;

FIG. 16 is a view showing evaluation results of difference degrees bythe SAD, SSD and MAD; and

FIG. 17 is a view showing evaluation results of difference degrees bythe SAD and SSD in the prior art.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Embodiments of the present invention will now be described withreference to the accompanying drawings.

First Embodiment

FIG. 1A and FIG. 1B are perspective views showing an external structureof a digital camera in a case where a difference degree evaluationdevice according to a first embodiment of the present invention isapplied to the digital camera. FIG. 1A mainly shows a front-sidestructure, and FIG. 1B mainly shows a rear-side structure.

The digital camera 1 comprises a body 2 having a substantiallyrectangular thin-plate shape. The front surface of the body 2 includes aphotography lens 3, a self-timer lamp 4, an optical viewfinder window 5,a strobe emission unit 6, and a microphone unit 7. A power key 8 and ashutter key 9 are provided on a right side (as viewed from the user) ofthe top surface of the body 2.

The power key 8 is a key for turning on/off power. The shutter key 9 isa key for instructing a photography timing at the time of photography.

The rear surface of the body 2 is provided with a photography mode (R)key 10, a playback mode (P) key 11, an optical finder 12, a speaker unit13, a macro-key 14, a strobe key 15, a menu (MENU) key 16, a ring key17, a set (SET) key 18, and a display unit 19.

The photography mode key 10 is a key for setting a photography mode. Ifthe photography mode key 10 is operated in a power-off state, power isautomatically turned on and a still-image mode is set. The still-imagemode and a moving-image mode are alternately set by repeatedly operatingthe photography mode key 10 in the power-on state. The still-image modeis used in the case of photographing a still image. The moving-imagemode is used in the case of photographing a moving image.

The shutter key 9 is commonly used in these photography modes.Specifically, in the still-image mode, a still image is captured at thetiming when the shutter key 9 is pressed. In the moving-image mode, thecapture of a moving image is started at the timing of pressing of theshutter key 9 and the capture of the moving image is finished at thetiming of re-pressing of the shutter key 9.

The playback mode key 11 is a key for setting a playback mode. If theplayback mode key 11 is operated in the power-off state, power isautomatically turned on and the playback mode is set.

The macro-key 14 is operated in the case of executing switching betweennormal photography and macro-photography in the state of the still-imagemode. The strobe key 15 is operated in the case of switching the lightemission mode of the strobe emission unit 6. The menu key 16 is operatedin the case of selecting various menu items including a successivephotography mode.

The ring key 17 is configured such that keys for item selection inupward, downward, leftward and rightward directions are integrallyformed. The set key 18, which is positioned at the center of the ringkey 17, sets a currently selected item.

The display unit 19 is composed of a color liquid crystal panel with abacklight. The display unit 19 displays a through-image as an electronicfinder at the time of the photography mode. The display unit 19 alsodisplays, e.g. an image, which is selected as an object of playback, atthe time of the playback mode.

Although not shown, a memory card slot for attaching/detaching a memorycard, which is used as a recording medium, is provided on the bottomsurface of the body 2. In addition, a USB (Universal Serial Bus)connector, for instance, is provided as a serial interface connector forconnection to an external personal computer, etc.

FIG. 2 is a block diagram showing an electronic circuit structure of thedigital camera 1.

The digital camera 1 includes an optical lens device 21, an image sensor22, a memory 23, a display device 24, an image processing device 25, anoperation unit 26, a computer interface unit 27, an external memory IOdevice 28, a program code memory device 29, a CPU 30, and a memory card31.

The optical lens device 21 includes a lens optical system, whichincludes a focus lens and a zoom lens (not shown) that constitute thephotography lens 3, and a driving unit which drives the lens opticalsystem. The optical lens device 21 converges light from an object ofphotography onto the image sensor 22, thereby focusing an image.

The image sensor 22 captures the focused image as digitized image data,and is composed of, e.g. a CCD (Charge Coupled Device). The image sensor22 is controlled by the CPU 30. If the shutter key 9 is not pressed, theimage sensor 22 generates digital image data for preview with a lowresolution, and periodically sends the image data to the memory 23 atintervals of about 30 frames per second. If the shutter key 9 ispressed, the image sensor 22 generates image data with a highresolution, and sends the generated image data to the memory 23. Thephotographic sensitivity (ISO sensitivity) of the image sensor 22 can beset by the CPU 30.

The memory 23 temporarily stores a low-resolution preview image orhigh-resolution image data, which is sent from the image sensor 22, ororiginal image data that is to be processed by the image processingdevice 25 or image data that has been processed. The temporarily storedimage data in the memory 23 is transmitted to the display device 24 orthe image processing device 25 by CPU 30.

The display device 24 displays an image on the display unit 19 that is aliquid crystal monitor. The display device 24 causes the display unit 19to display a low-resolution preview image or a high-resolution image,which is temporarily stored in the memory 23.

The image processing device 25 executes an image process, such ascompression of image data, on the image data that is temporarily storedin the memory 23.

The operation unit 26 is composed of, in addition to the shutter key 9,the power key 8, photography mode key 10, playback mode key 11,macro-key 14, strobe key 15, menu key 16, ring key 17 and set key 18.Signals, which are produced by the operations of these keys, aredirectly sent to the CPU 30.

When the digital camera 1 is connected to the computer (not shown), thecomputer interface unit 27 operates as a USB storage class driver.Thereby, when the computer is connected to the digital camera 1, thecomputer handles the memory card 31 as an external memory device.

The external memory IO device 28 executes input/output of image data,etc. from/to the memory card 31. The memory card 31 stores image data,etc, which is supplied from the external memory IO device 28.

The program code memory device 29 stores a program that is executed bythe CPU 30. The program code memory device 29 is composed of a ROM, aflash memory, or the like.

The CPU 30 controls the whole system in accordance with the program thatis stored in the program code memory device 29. The memory 23 is alsoused as a working memory of the CPU 30.

If operation information is transmitted by the depression of the switchkey of the operation unit 26, the CPU 30 controls, on the basis of theoperation information, the image sensor 22, memory 23, display device 24and image processing device 25.

Specifically, if operation information of the photography mode key 10 issent from the operation unit 26, the CPU 30 sets the respective units inthe photography mode. If the shutter key 9 is not pressed in this state,the CPU 30 sets the image sensor 22 in the preview mode. If the shutterkey 9 is pressed, the CPU 30 sets the image sensor 22 in thehigh-resolution mode in which an image of the object of photography witha high resolution is read in. At this time, if the successivephotography mode is set by the operation of the menu key 16, apredetermined number of images are read at predetermined time intervalsin accordance with the depression of the shutter key 9.

If operation information of the playback mode key 11 is transmitted, theCPU 30 sets the respective units in the playback mode.

The CPU 30, for example, records a preview image and high-resolutionimage data in the memory card 31 via the external memory IO device 28,and reads out image data that is recorded in the memory card 31. The CPU30 records, for instance, image data, which is compressed in JPEGformat, in the memory card 31.

When image data is temporarily stored in the memory 23, the CPU 30records a preview image and high-resolution image data in differentmemory areas. In addition, the CPU 30 records image data in the memorycard 31 by dividing the image data into image files.

The CPU 30, for example, records a preview image and high-resolutionimage data in the memory card 31 via the external memory IO device 28,and reads out the recorded image data from the memory card 31. The CPU30 creates image files which store image data.

Next, a description is given of a case in which image synthesis isexecuted by the digital camera 1.

Normally, in template matching that is used in alignment of imagesynthesis, an SSD (Sum of Squared Difference) or a SAD (Sum of AbsoluteDifference) is generally used as an evaluation value of a differencedegree. As has been described above, the SSD and SAD have their meritsand demerits.

In the first embodiment, a new evaluation method is adopted, wherein amaximum absolute difference value, which is called MAD (Max of AbsoluteDifference), is used as an evaluation value of a difference degree. LikeSSD and SAD, the definition of MAD can be expressed by:

$\begin{matrix}{{M\; A\;{D(d)}} = {\max\limits_{p \in T}{{R_{p} - O_{p + d}}}}} & (5)\end{matrix}$

FIG. 3 is a block diagram showing a functional configuration of the CPU30 for realizing difference degree evaluation using the MAD. In thefirst embodiment, the function of the CPU 30 comprises a signalacquisition unit 30 a, a sample extraction unit 30 b, an arithmeticprocess unit 30 c and a filter process unit 30 d.

The signal acquisition unit 30 a acquires at least two signals which areobjects of matching. In the present embodiment, since images are used asexamples of the objects of matching, two images which are obtained bysuccessive photography are acquired. In this case, one of the two imagesis stored in a first buffer 23 a of the memory 23 as a reference imageR, and the other is stored in a second buffer 23 b as an object image O.

The sample extraction unit 30 b extracts pixels of the object image O,which correspond to the pixels in a predetermined block (template) ofthe reference image R.

The arithmetic process unit 30 c executes an arithmetic process fordifference degree evaluation. In the first embodiment, the arithmeticprocess unit 30 c executes an arithmetic process of the MAD shown in theabove equation (5). Specifically, the arithmetic process unit 30 c findsabsolute difference values between the pixels of the object image O,which are extracted by the sample extraction unit 30 b, and the pixelsof the reference image R. A maximum value of the absolute differencevalues (maximum absolute difference value) is calculated as anevaluation value.

The filter process unit 30 d is composed of a low-pass filter (LPF). Thefilter process unit 30 d subjects the reference image R and object imageO, which are the objects of matching, to a filter process for cutting ahigh frequency component above a predetermined frequency.

Next, a specific process procedure is described.

FIG. 4 shows an example of matching between a reference image and anobject image in the first embodiment. As shown in FIG. 4, a block of 16pixels×16 pixels, which is set at a predetermined position in thereference image R, is used as a template. Consider a case of executing asearch as to which position in the object image O corresponds to eachpixel in the template.

FIG. 5 is a flow chart illustrating the flow of a main process of thedigital camera 1 according to the first embodiment.

The process illustrated in the flow chart of FIG. 5 is executedaccording to the procedure described in a program that is read in theCPU 30, which is a microcomputer, from the program code memory device29. The same applies to other embodiments of the invention. The programcorresponding to each embodiment is stored in the program code memorydevice 29, and the CPU 30 reads in the program to execute thecorresponding process.

To start with, as shown in FIG. 5, the CPU 30 acquires at least twoimages which are objects of matching (step S101). The CPU 30 stores oneof the two images in the first buffer 23 a of the memory 23 as areference image R, and stores the other image in the second buffer 23 bof the memory 23 as an object image O (step S102). Available methods ofacquiring images include, for instance, a method of acquiring images viathe image sensor 22 and a method of acquiring images via the memory card31 or an external communication network.

Subsequently, the CPU 30 executes initial setting, and sets a constant Awhich is indicative of a search range of the object image O, andconstants B and C which are indicative of the position of the templatein the reference image R (step S103). For example, if A=16, the searchrange is a square range of “0 to 15” in the x direction and “0 to 15” inthe y direction. If B=100 and C=200, a rectangular block of 16 pixels×16pixels, the upper left corner of which is at coordinates (100, 200), isset as a template.

It is possible to adopt such a structure that the coordinates B, C arearbitrarily settable by the user. In usual cases, the coordinates B, Care automatically set by a characteristic point extraction process, orthe coordinates B, C are automatically set on a predetermined blockwithin the screen, as in the case of block matching of imagecompression. In the case where there are a plurality of templates, thesetting of these values and the main process of the present embodimentare repeatedly executed in succession.

After the above-described initial setting, the CPU 30 applies a low-passfilter to the reference image R that is stored in the first buffer 23 aof the memory 23 (step S104). The low-pass filter may be a generallinear digital filer. In this case, the filter process may be applied tothe entire image, but it should suffice if the filter process is appliedto only the pixel set within the template.

In addition, the CPU 30 applies a low-pass filter to the object image Othat is stored in the second buffer 23 b of the memory 23 (step S105).As has been described above, the low-pass filter may be a general lineardigital filter. The filter process may be applied to the entire image,but it should suffice if the filter process is applied to only the pixelset within the search range.

The CPU 30 initializes a variable min, which is indicative of a minimumvalue of a difference degree evaluation value, by a sufficiently largeconstant (expressed as “INF” in this embodiment) (step S106).Subsequently, the CPU 30 sets a loop range for a minimum value search(step S107). In this case, since a two-dimensional search of an image isexecuted, the range is “0 to A−1” in both the x component and ycomponent, and the increment is 1.

If the loop of the minimum value search is started, the CPU 30 calls apredetermined function mad, and acquires an evaluation value t of asearch position (x, y), which is indicative of an offset of thereference image R and object image O (step S108). The function mad willbe explained later with reference to a flow chart of FIG. 6.

If the acquired evaluation value t is less than a previous minimum valuemin (Yes at step S109), the CPU 30 updates the minimum value min to t(step S110). In addition, the CPU 30 saves the search position (x, y) atthis time for the variables minx, miny (step S111).

Subsequently, the CPU 30 updates the search position (x, y) with anincrement of +1 (step S113), and repeats the same process. Uponcompletion of the search within the set range (Yes at step S112), thecoordinates (minx, miny) are obtained as corresponding coordinates. Onthe basis of the obtained corresponding coordinates, alignment betweenthe reference image R and object image O is executed, and an image issynthesized. The synthesized image data is recorded in the memory card31 via the external memory IO device 28, or is output to the displaydevice 24.

Next, a description is given of the process relating to the function madin step S108.

The function mad is a function for finding a difference degreeevaluation value by the above-described MAD (Max of AbsoluteDifference). Arguments x and y of the function are delivered from themain process, and indicate the x component and y component of the offsetof the reference image R and object image O.

FIG. 6 is a flow chart illustrating a process procedure of the functionmad, which is called from the main process of the digital camera 1.

If the function mad is called, the CPU 30 initializes the variable max,which is indicative of the maximum value of absolute differences, by 0(step S201). The CPU 30 sets the range of variables tx and ty, whichrepresent the pixels within the template, and starts the loop (stepS202).

In the embodiment, the template is a square block of 16×16 pixels.Accordingly, the range of the x component is “B to B+15” and the rangeof the y component is “C to C+15”, and the increment is 1 in each range.As mentioned above, the coordinates (B, C) indicate the upper leftcorner coordinates of the template block in the reference image R.

In the loop, the CPU 30 calculates an absolute difference value(variable s) between each of the pixels within the template of thereference image R and the corresponding pixel of the object image O thatis displaced by the offset x, y (step S203). The CPU 30 successivelyexecutes comparison and update (step S206, S207) so as to save themaximum one of the absolute difference values for the variable max (stepS204, S205).

After the completion of the loop (Yes at step S206), the max is thefinally found evaluation value of the difference degree, and this valuebecomes the return value to the main process (step S208).

As described above, when the matching between the reference image R andobject image O is executed, the maximum absolute difference value (MAD)is found, and this value is used as the evaluation value of thedifference degree. Thereby, the following advantageous effects can beobtained.

Specifically, the MAD, like the SSD, has a measure which emphasizes thelocal peak property of difference. Compared to the SSD, the MAD is moresensitive to the peak. Thus, the MAD is very robust to a variation inbrightness, and the robustness of matching can be secured.

In this case, if one-dimensional signals a_(i) and b_(i) shown in FIG.15 are exemplified, the MAD can be expressed by the following equation(6) on the basis of equation (5):MAD=max|a _(i) −b _(i)|  (6)

As shown in FIG. 16, if evaluation values by MAD are added, “2” isobtained for “a_(i)−b_(i)”, and “1” is obtained for “a_(i)−b_(i-1)”, andit is understood that the matching precision of the MAD is higher thanthat of the SSD. The dispersion of the evaluation values is generallyclear, compared to the SSD.

Since the arithmetic operation of the MAD relates to only the absolutedifference values and the comparison, the circuit scale of the MAD issmaller than that of the SSD that requires a squaring arithmeticoperation. The number of digits of the obtained evaluation value isunchanged and is in the range of pixel difference values. Accordingly,the MAD is applicable even in smaller ranges than the SAD as well as theSSD. For example, when the sub-pixel positions are approximated on thebasis of the evaluation values (e.g. isogonal line fitting), the circuitscale becomes very small.

As described above, with the introduction of the MAD, the merits of theSSD and SAD can be obtained, and better advantageous effects can beobtained.

In the MAD, however, if pulse-like noise with a high peak mixes in thereference image R or object image O, an erroneous matching result may beoutput due to the influence of the noise. In such a case, if thereference image R and object image O are subjected to low-passfiltering, as at steps S104 and S105 in FIG. 5, the peak of the noiseincluded in the reference image R and object image O can be suppressed,and the stability of matching by the MAD can be obtained.

In the above-described present embodiment, images are used as inputsignals. The invention, however, is not limited to the application tothe images or two-dimensional signals, but is similarly applicable toone-dimensional signals and three-dimensional signals. In this case,simply by varying the hierarchical structure of the loop in accordancewith the dimensions, evaluation values by the definition formula of theMAD can be calculated with respect to the set of sample points.

The template is not limited to the square block, and may be a block ofan arbitrary shape. In this case, this can be achieved by changing theloop relating to the indices of x and y to a loop for each pixel whichreflects the arbitrary shape.

In the above-described embodiment, the coordinate transformation modelbetween the reference image R and object image O is parallel movement,and the offset is expressed by (x, y). Alternatively, the offset may bechanged to (x, y, θ) including rotation, or the number of parameters maybe increased as in the case of affine transformation or projectivetransformation.

In the above description of the embodiment, the shape of the matchingsearch range is square, and the entire square range is searched.However, the shape of the search range may arbitrarily be set, and apartial search, such as an N-step search, may be executed instead of theall-number search. This can be realized by altering the search loopstructure.

Second Embodiment

Next, a second embodiment of the present invention is described.

The object of the process of the second embodiment is the same as in thefirst embodiment, but the method of calculating difference degreeevaluation values is different. Specifically, in the second embodiment,SAD and MAD are combined, and the following evaluation equation is used:SAD+k·MAD=Σ|a _(i) −b _(i) +k·max|a _(i) −b _(i)|  (7)

In the equation (7), k is a constant and is arbitrarily settable in apredetermined range. As the value of k increases, the evaluation valueby MAD becomes more robust. Thus, in the case where a level differencebetween signals a_(i) and b_(i) is large, the MAD can effectively beused by increasing the value of k. Conversely, in the case where thelevel difference between signals a_(i) and b_(i) is small or in the casewhere peak-like noise is included, the SAD can effectively be used bydecreasing the value of k.

A specific process procedure relating to the second embodiment will nowbe described.

The device structure of the second embodiment is basically the same asthat of the first embodiment, and a description thereof is omitted here.In the second embodiment, however, the arithmetic process unit 30 c ofthe CPU 30 shown in FIG. 3 executes an arithmetic process of differencedegree evaluation according to the above equation (7).

To be more specific, a maximum value (MAD) of absolute difference valuesbetween the pixels of the reference image R and the pixels of the objectimage O is calculated as a first evaluation value. In addition, the sumof absolute difference values between the pixels of the reference imageR and the pixels of the object image O is calculated as a secondevaluation value. The first evaluation value and the second evaluationvalue are linearly coupled with a predetermined ratio (k), and thelinearly coupled value is calculated as a final evaluation value.

The process procedure of the main process is the same as shown in FIG.5, but the process of step S108 of calling the function mad (x, y) isreplaced with a step of calling a function sadplusmad (x, y). Since theother steps and the whole process procedure are the same, a descriptionthereof is omitted.

The function sadplusmad (x, y) is a function for finding a differencedegree evaluation value by linear coupling between SAD and MAD.Arguments x and y of the function are delivered from the main process,and indicate the x component and y component of the offset of thereference image R and object image O.

FIG. 7 is a flow chart illustrating a process procedure of the functionsadplusmad, which is called from the main process of the digital camera1 in the second embodiment.

If the function sadplusmad is called, the CPU 30 initializes a variablesum, which is indicative of the sum of absolute difference values, by 0(step S301). In addition, the CPU initializes a variable max, which isindicative of the maximum value of absolute difference values, by 0(step S302). The CPU 30 sets the range of variables tx and ty, whichrepresent the pixels within the template, and starts the loop (stepS303).

In the embodiment, the template is a square block of 16×16 pixels.Accordingly, the range of the x component is “B to B+15” and the rangeof the y component is “C to C+15”, and the increment is 1 in each range.As mentioned above, the coordinates (B, C) indicate the upper leftcorner coordinates of the template block in the reference image R.

In the loop, the CPU 30 calculates an absolute difference value(variable s) between each of the pixels within the template of thereference image R and the corresponding pixel of the object image O thatis displaced by the offset x, y (step S304). The CPU 30 saves themaximum one of the absolute difference values for the variable max (stepS305, S306). Subsequently, the CPU 30 successively executes comparisonand update (step S308, S309) so as to add the absolute difference value(variable s) to the variable sum (step S307).

After the completion of the loop, a value that is obtained by adding avalue, which is calculated by multiplying the variable max by k, to thevariable sum is a finally obtained difference degree evaluation value t,and this value becomes the return value to the main process (step S310).

As has been described above, when matching between the reference image Rand object image O is executed, the sum (SAD) of absolute differencevalues and the maximum absolute difference value (MAD) are combined tocalculate the difference degree evaluation value. Thereby, the followingadvantageous effects can be obtained.

The demerit of the MAD is the weakness to peak-like noise. By linearlycoupling the MAD to the SAD that is robust to noise, intermediatecharacteristics, which are close to the characteristics of SSD, can beobtained. Thereby, even in the case where peak-like noise is included inthe reference image R and object image O, a stable matching result canbe obtained.

In addition, since the ratio between the SAD and MAD can be adjusted bythe constant k, a more excellent matching result can be obtained if theconstant k is set in accordance with the state of images that areobjects of matching.

Examples of the method of adjusting the constant k that determines theratio between SAD and MAD include a method in which the user arbitrarilysets the constant k through a setting screen (not shown). Anotherexample is a method in which images that are the objects of matching areanalyzed, and the constant k is automatically adjusted to a proper valuein accordance with the state of noise included therein.

The advantage that the hardware structure is simpler than in the case ofthe SSD is the same as in the first embodiment.

Aside from the search for matching between images, this embodiment isapplicable to the discrimination of signals on the basis of thecomparison of difference degrees of general signals (i.e. comparison ofsimilarity). In this case, the template may be the entirety of a signal.

Third Embodiment

Next, a third embodiment of the present invention is described.

The object of the process of the third embodiment is the same as in thefirst embodiment, but the method of calculating difference degreeevaluation values is different. Specifically, in the third embodiment,the template for matching is divided into smaller divisional areas, thesums (SAD) of absolute difference values of pixel values in therespective divisional areas are found, and the maximum value of the sumsis calculated as the evaluation value.

Referring now to FIG. 8A and FIG. 8B, a detailed description is given.

FIG. 8A and FIG. 8B are conceptual views for explaining area division inthe third embodiment of the invention. FIG. 8A shows a square block of16×16 pixels in a case of finding difference values between the pixelsof the template of the reference image R and the pixels of the objectimage O that is offset. The cells divided by solid lines and brokenlines in FIG. 8A correspond to the pixels of the template.

In the third embodiment, the template is divided into sub-blocks eachhaving a small square shape of 2×2 pixels, as shown in FIG. 8B. Thenumber of sub-blocks is 8×8. The sum of absolute difference values (SAD)corresponding to 2×2 pixels in each of the sub-blocks is calculated, and8×8 values corresponding to the positions of the cells in FIG. 8B areobtained. The maximum value of the 8×8 values is set as a differencedegree evaluation value.

Next, a specific process procedure relating to the third embodiment isdescribed.

The device structure of the third embodiment is basically the same asthat of the first embodiment. In the third embodiment, however, thesample extraction unit 30 b of the CPU 30 shown in FIG. 3 divides thetemplate (block) into a plurality of divisional areas (sub-blocks), andextracts sample points from the reference image R and object image Owith respect to each of the divisional areas. In addition, thearithmetic process unit 30 c finds the sum (SAD) of absolute differencevalues of the sample points between the reference image R and objectimage O with respect to each of the divisional areas, and the maximumone of the found sums (SAD) is calculated as an evaluation value.

The process procedure of the main process is the same as shown in FIG.5, but the process of step S108 of calling the function mad (x, y) isreplaced with a step of calling a function maxsad (x, y). Since theother steps and the whole process procedure are the same, a descriptionthereof is omitted.

The function maxsad (x, y) is a function which realizes an advantageouseffect similar to the advantageous effect of the MAD (Max of AbsoluteDifference) by the hierarchical application of the SAD (Sum of AbsoluteDifference) and a maximum value arithmetic operation. Arguments x and yof the function are delivered from the main process, and indicate the xcomponent and y component of the offset of the reference image R andobject image O.

FIG. 9 is a flow chart illustrating a process procedure of the functionmaxsad, which is called from the main process of the digital camera 1 inthe third embodiment.

If the function maxsad is called, the CPU 30 initializes a variable max,which is indicative of the maximum value of the sums of absolutedifference values in the respective sub-blocks, by 0 (step S401). TheCPU 30 sets the range of variables tx and ty, which represent the pixelswithin the template (step S402), and starts the loop with respect toeach sub-block of 2×2 pixels.

In the present embodiment, the template is a square block of 16×16pixels. Accordingly, the range of the x component is “B to B+15” and therange of the y component is “C to C+15”, and the increment is 2 in eachrange. Thus, the number of times of the loop is 8×8. As mentioned above,the coordinates (B, C) indicate the upper left corner coordinates of thetemplate block in the reference image R.

In the loop, the CPU 30 calculates, with respect to each of thesub-blocks, difference values between the pixels in the template of thereference image R and the corresponding pixels of the object image Othat is displaced by the offset x, y (steps S403 to S406). It is assumedthat the difference values, which are obtained with respect to eachsub-block, are s0, s1, s2 and s3.

Subsequently, the CPU 30 finds the absolute sum of absolute values byusing the variables s0, s1, s2 and s3 (step S407). If the absolute sumof absolute values is a variable s, the following operation is executed:s=s0+s1|+|s2|+|s3|  (8)

While updating the variables tx and ty, the CPU 30 successively executescomparison of the sums (variables s) of absolute difference values whichare obtained in each loop, and saves the maximum one of the sums ofabsolute difference values for the variable max (step S408 to S411).

After the completion of the loop (Yes at step S410), the value of max isthe finally found evaluation value t of the difference degree, and thisvalue becomes the return value to the main process (step S412).

As has been described above, when matching between the reference image Rand object image O is executed, the template is divided into pluraldivisional areas, and the maximum value of the sums of absolutedifference values of the respective divisional areas is calculated asthe evaluation value. Thereby, the process can be executed with thenoise component being dispersed, and the stable matching result can beobtained even if there is a level difference between images.

The advantage that the hardware structure is simpler than in the case ofthe SSD is the same as in the first embodiment.

As regards the method of dividing the block into sub-blocks, the shapeof the sub-block is not limited to the small square of 2×2 pixels, andmay be, for instance, a small square of 4×4 pixels, or a line of 1×16pixels.

Aside from the search for matching between images, this embodiment isapplicable to the discrimination of signals on the basis of thecomparison of difference degrees of general signals (i.e. comparison ofsimilarity). In this case, the template may be the entirety of a signal.

Fourth Embodiment

Next, a fourth embodiment of the present invention is described.

In the fourth embodiment, two arithmetic processes, namely, anarithmetic process of difference degree evaluation by MAD and anarithmetic process of difference degree evaluation by SAD, are provided,and these two processes are selectively used to execute differencedegree evaluation.

FIG. 10 is a block diagram showing a functional configuration of the CPU30 which is provided in a digital camera 1 according to the fourthembodiment of the invention. In the fourth embodiment, the function ofthe CPU 30 comprises a signal acquisition unit 30 a, a sample extractionunit 30 b, a first arithmetic process unit 30 e, a second arithmeticprocess unit 30 f, an evaluation control unit 30 g, a level differencedetection unit 30 h and a photography mode setting unit 30 i.

The signal acquisition unit 30 a acquires at least two signals which areobjects of matching. In the present embodiment, since images are used asexamples of the objects of matching, two images which are obtained bysuccessive photography are acquired. In this case, one of the two imagesis stored in the first buffer 23 a of the memory 23 as a reference imageR, and the other is stored in the second buffer 23 b as an object imageO.

The sample extraction unit 30 b extracts pixels of the object image O,which correspond to the pixels in a predetermined block of the referenceimage R.

The first arithmetic process unit 30 e executes an arithmetic process ofthe MAD, which is expressed in the equation (5). Specifically, the firstarithmetic process unit 30 e finds absolute difference values betweenthe pixels of the object image O, which are extracted by the sampleextraction unit 30 b, and the pixels of the reference image R, andcalculates a maximum value of the absolute difference values as anevaluation value.

The second arithmetic process unit 30 f executes an arithmetic processof the SAD, which is indicated in the equation (2). Specifically, thesecond arithmetic process unit 30 f finds a sum of absolute differencevalues between the pixels of the object image O, which are extracted bythe sample extraction unit 30 b, and the pixels of the reference imageR, and calculates the sum of absolute difference values as an evaluationvalue.

The evaluation control unit 30 g selectively uses one of the firstarithmetic process unit 30 e and second arithmetic process unit 30 f,thereby executing difference degree evaluation.

The level difference detection unit 30 h detects a level differencebetween the reference image R stored in the first buffer 23 a of thememory 23 and the object image O stored in the second buffer 23 b of thememory 23.

The photography mode setting unit 30 i sets photography modescorresponding to various scenes, such as “portrait photography”,“landscape photography” and “night landscape photography”.

The operation of the fourth embodiment will now be described withrespect to a case (a) of selectively using MAD and SAD in accordancewith the level difference, and a case (b) of selectively using MAD andSAD in accordance with the photography mode.

(a) Case of Selectively Using MAD and SAD in Accordance with the LevelDifference

FIG. 11 is a flow chart illustrating a process in a case where MAD andSAD are selectively used in accordance with a level difference in thedigital camera 1 according to the fourth embodiment.

To start with, the CPU 30 acquires a reference image R and an objectimage O, which are objects of matching (step S501). The CPU 30 storesthe reference image R and object image O in the first buffer 23 a andsecond buffer 23 b of the memory 23, respectively (step S502).

The CPU 30 detects a level difference between the reference image R andobject image O (step S503). This is carried out, for example, bycomparing the mean brightness of the pixels of the reference image R andthe mean brightness of the pixels of the object image O.

If the level difference between the reference image R and object image Ois a predetermined value or more (Yes at step S504), the CPU 30 executesthe difference degree evaluation by using MAD (step S505, S506).Specifically, as has been described in connection with the firstembodiment, the CPU 30 extracts the pixels of the object image Ocorresponding to the pixels in the template of the reference image R,finds absolute difference values between these pixels, and calculatesthe maximum value of the absolute difference values as the evaluationvalue.

On the other hand, if the level difference between the reference image Rand object image O is less than the predetermined value (No at stepS504), the CPU 30 executes the difference degree evaluation by using SAD(step S507, S508). Specifically, as has been described in connectionwith the second embodiment, the CPU 30 extracts the pixels of the objectimage O corresponding to the pixels in the template of the referenceimage R, and calculates the sum of absolute difference values betweenthese pixels as the evaluation value.

As has been described above, when matching between the reference image Rand object image O is executed, the level difference between both imagesis detected and one of the MAD and SAD is selectively used. Thereby, thedifference degree evaluation can be executed by making use of theadvantages of the MAD and SAD, and a stable matching result can alwaysbe obtained.

The advantage that the hardware structure is simpler than in the case ofthe SSD is the same as in the first embodiment.

(b) Case of Selectively Using MAD and SAD in Accordance with thePhotography Mode

For example, in the case where an image which is photographed withlong-time exposure and an image which is photographed with short-timeexposure are synthesized to increase the dynamic range, the meanbrightness levels do not agree. In such a case, it is possible thatmatching between images cannot be executed by the SAD. In addition, ifsuccessive photograph is executed under a fluorescent lamp, a partiallevel difference occurs between images due to flicker. In such a case,too, it is possible that matching between images cannot be executed bythe SAD.

To cope with this, the photography mode in which a level differenceoccurs between images is determined as “specific photography mode”. Ifthe “specific photography mode” is set, the MAD is used. A specificprocess procedure is described below.

FIG. 12 is a flow chart illustrating a process in a case where MAD andSAD are selectively used in accordance with the photography mode of thedigital camera 1 according to the fourth embodiment.

To start with, a mode setting screen (not shown) is displayed by apredetermined operation. The photography mode, which is selected by theuser, is set (step S601). The mode setting screen includes modes inwhich subjects are photographed under specific environments such as“expansion of dynamic range” and “successive photography under afluorescent lamp” as described above, as well as modes corresponding togeneral photography scenes such as “portrait photography”, “landscapephotography” and “night landscape photography”.

The CPU 30 acquires a reference image R and an object image O, which areobjects of matching (step S602), and stores the reference image R andobject image O in the first buffer 23 a and second buffer 23 b of thememory 23, respectively (step S603).

The CPU 30 determines the currently set photography scene (step S604).If the specific photography mode is set, for example, if the photographymode in which a level difference occurs between the images, such as“expansion of dynamic range” and “successive photography under afluorescent lamp” as described above, is set (Yes at step S604), the CPU30 executes the difference degree evaluation by using MAD (step S605,S606). Specifically, as has been described in connection with the firstembodiment, the CPU 30 extracts the pixels of the object image Ocorresponding to the pixels in the template of the reference image R,finds absolute difference values between these pixels, and calculatesthe maximum value of the absolute difference values as the evaluationvalue.

On the other hand, if the specific photography scene is not set (No atstep S604), the CPU 30 executes the difference degree evaluation byusing SAD (step S607, S608). Specifically, as has been described inconnection with the second embodiment, the CPU 30 extracts the pixels ofthe object image O corresponding to the pixels in the template of thereference image R, and calculates the sum of absolute difference valuesbetween these pixels as the evaluation value.

As has been described above, when matching between the reference image Rand object image O is executed, one of the MAD and SAD is selectivelyused in accordance with the photography scene. Thereby, the differencedegree evaluation can be executed by making use of the advantages of theMAD and SAD, and a stable matching result can be obtained.

The advantage that the hardware structure is simpler than in the case ofthe SSD is the same as in the first embodiment.

In the fourth embodiment, the SAD is used as the arithmetic processother than the MAD, and the MAD and SAD are selectively used to executethe difference degree evaluation. Alternatively, the SSD may be used inplace of the SAD. In the case of the SSD, there is such a problem thatthe cost for implementation is high. However, if the SSD is implementedby software, such a problem can be reduced.

In the fourth embodiment, it is preferable to apply the low-pass filter,as described in the first embodiment, to the reference image R andobject image O, at least in the arithmetic process of MAD.

Fifth Embodiment

Next, a fifth embodiment of the present invention is described.

In the fifth embodiment, two arithmetic processes, namely, an arithmeticprocess of difference degree evaluation by MAD and an arithmetic processof difference degree evaluation by SAD, are provided. In a case where anevaluation value, which is obtained by one of the two arithmeticprocesses, is a reference value or more, an evaluation value is obtainedby the other arithmetic process. The evaluation value, which is obtainedby the arithmetic operation, is indicative of the difference degreebetween images. Accordingly, the matching is better as the evaluationvalue is lower, and the matching is poorer as the evaluation value ishigher.

As regards the device structure, FIG. 10 is referred to. In the fifthembodiment, the evaluation control unit 30 g of the CPU 30 executesdifference degree evaluation by using one of the first arithmeticprocess unit 30 e and second arithmetic process unit 30 f, and executes,if the evaluation value obtained at this time is a reference value ormore, difference degree evaluation by using the other of the firstarithmetic process unit 30 e and second arithmetic process unit 30 f.

The operation of the fifth embodiment will now be described with respectto a case (a) of preferentially using MAD, and a case (b) ofpreferentially using SAD.

(a) Case of Preferentially Using MAD

FIG. 13 is a flow chart illustrating a process in a case where MAD ispreferentially used in the digital camera 1 according to the fifthembodiment.

To start with, the CPU 30 acquires a reference image R and an objectimage O, which are objects of matching (step S701). The CPU 30 storesthe reference image R and object image O in the first buffer 23 a andsecond buffer 23 b of the memory 23, respectively (step S702).

The CPU 30 executes the difference degree evaluation by using MAD (stepS703, S704). Specifically, as has been described in connection with thefirst embodiment, the CPU 30 extracts the pixels of the object image Ocorresponding to the pixels in the template of the reference image R,finds absolute difference values between these pixels, and calculatesthe maximum value of the absolute difference values as the evaluationvalue.

If the calculated evaluation value is a reference value or more, thatis, if the evaluation value t, which is finally obtained by successivelyfinding the maximum absolute difference value with respect to eachpixel, fails to meet the reference value and correct matching cannot beexecuted (Yes at step S705), the CPU 30 switches the MAD to the SAD andexecutes difference degree evaluation (step S706). Specifically, as hasbeen described in connection with the second embodiment, the CPU 30extracts the pixels of the object image O corresponding to the pixels inthe template of the reference image R, and calculates the sum ofabsolute difference values between these pixels as the evaluation value.In this case, since the process of extracting corresponding pixels hasalready been carried out in step S703, the arithmetic process alone maybe executed.

If an evaluation value less than the reference value cannot be obtainedeven with the use of the SAD that is substituted for the MAD, a matchingerror is determined and the process is finished, for example, bydisplaying an error message.

As has been described above, by selectively using one of the MAD andSAD, the difference degree evaluation can be executed by making use ofthe advantages of the MAD and SAD, and a stable matching result canalways be obtained. In particular, the matching between images, whichhave a level difference, can effectively be executed by preferentiallyusing the MAD.

The advantage that the hardware structure is simpler than in the case ofthe SSD is the same as in the first embodiment.

(b) Case of Preferentially Using SAD

FIG. 14 is a flow chart illustrating a process in a case where SAD ispreferentially used in the digital camera 1 according to the fifthembodiment.

To start with, the CPU 30 acquires a reference image R and an objectimage O, which are objects of matching (step S801). The CPU 30 storesthe reference image R and object image O in the first buffer 23 a andsecond buffer 23 b of the memory 23, respectively (step S802).

The CPU 30 executes the difference degree evaluation by using SAD (stepS803, S804). Specifically, as has been described in connection with thesecond embodiment, the CPU 30 extracts the pixels of the object image Ocorresponding to the pixels in the template of the reference image R,and calculates the sum of absolute difference values between thesepixels as the evaluation value.

If the calculated evaluation value is a reference value or more, thatis, if the evaluation value t, which is finally obtained by successivelyfinding the sum of absolute difference values with respect to eachpixel, fails to meet the reference value and correct matching cannot beexecuted (Yes in step S805), the CPU 30 switches the SAD to the MAD andexecutes difference degree evaluation (step S806). Specifically, as hasbeen described in connection with the first embodiment, the CPU 30extracts the pixels of the object image O corresponding to the pixels inthe template of the reference image R, finds absolute difference valuesbetween these pixels, and calculates the maximum value of the absolutedifference values as the evaluation value. In this case, since theprocess of extracting corresponding pixels has already been carried outin step S803, the arithmetic process alone may be executed.

If an evaluation value less than the reference value cannot be obtainedeven with the use of the MAD that is substituted for the SAD, a matchingerror is determined and the process is finished, for example, bydisplaying an error message.

As has been described above, by selectively using one of the MAD andSAD, the difference degree evaluation can be executed by making use ofthe advantages of the MAD and SAD, and a stable matching result canalways be obtained. In particular, the matching between images, whichinclude peak-like noise, can effectively be executed by preferentiallyusing the SAD.

The advantage that the hardware structure is simpler than in the case ofthe SSD is the same as in the first embodiment.

In the fifth embodiment, it is preferable to apply the low-pass filter,as described in the first embodiment, to the reference image R andobject image O, at least in the arithmetic process of MAD.

In each of the above-described embodiments, all processes are realizedby software. Alternatively, some or all of the processes may be realizedby hardware.

The present invention is applicable not only to digital cameras, butalso to any other devices having functions of matching signals such asimages.

The method that is described in connection with each of theabove-described embodiments may be constructed as a program that can beexecuted by a computer. The program may be stored in a recording mediumsuch as a magnetic disk (e.g. a flexible disk, a hard disk), an opticaldisk (e.g. a CD-ROM, a DVD-ROM) or a semiconductor memory, and may beapplied to various apparatuses. The program itself may be transmittedvia transmission media such as networks, and may be applied to variousapparatuses. The computer, which realizes the present apparatus, readsthe program that is stored in the recording medium or the program thatis provided via the transmission media, and the operation of theapparatus is controlled by the program. Thereby, the apparatus executesthe above-described process.

Additional advantages and modifications will readily occur to thoseskilled in the art. Therefore, the invention in its broader aspects isnot limited to the specific details and representative embodiments shownand described herein. Accordingly, various modifications may be madewithout departing from the spirit or scope of the general inventiveconcept as defined by the appended claims and their equivalents.

What is claimed is:
 1. A difference degree evaluation device comprising:a signal acquisition unit which acquires at least two signals which areobjects of matching; a memory unit which stores one of the two signals,which are acquired by the signal acquisition unit, as a referencesignal, and stores the other of the two signals as an object signal; asample extraction unit which extracts sample points of the object signalrespectively corresponding to sample points in a predetermined block ofthe reference signal stored in the memory unit; a first arithmeticprocess unit which calculates a maximum value of absolute differencevalues between the sample points of the reference signal and the samplepoints of the object signal, which are extracted by the sampleextraction unit, as an evaluation value; a second arithmetic processunit which calculates a sum of the absolute difference values betweenthe sample points of the reference signal and the sample points of theobject signal as the evaluation value; an evaluation control unit whichevaluates a difference degree by selectively using the first arithmeticprocess unit and the second arithmetic process unit; and a mode settingunit which sets a specific mode, wherein the evaluation control unitevaluates the difference degree by selecting the first arithmeticprocess unit in a case in which the specific mode is set by the modesetting unit, and selecting the second arithmetic process unit in a casein which the specific mode is not set by the mode setting unit.
 2. Adifference degree evaluation device comprising: a signal acquisitionunit which acquires at least two signals which are objects of matching;a memory unit which stores one of the two signals, which are acquired bythe signal acquisition unit, as a reference signal, and stores the otherof the two signals as an object signal; a sample extraction unit whichextracts sample points of the object signal respectively correspondingto sample points in a predetermined block of the reference signal storedin the memory unit; a first arithmetic process unit which calculates amaximum value of absolute difference values between the sample points ofthe reference signal and the sample points of the object signal, whichare extracted by the sample extraction unit, as an evaluation value; asecond arithmetic process unit which calculates a sum of squareddifference between the sample points of the reference signal and thesample points of the object signal as the evaluation value; anevaluation control unit which evaluates a difference degree byselectively using the first arithmetic process unit and the secondarithmetic process unit; and a mode setting unit which sets a specificmode, wherein the evaluation control unit evaluates the differencedegree by selecting the first arithmetic process unit in a case in whichthe specific mode is set by the mode setting unit, and selecting thesecond arithmetic process unit in a case in which the specific mode isnot set by the mode setting unit.
 3. A difference degree evaluationmethod comprising: a step of acquiring at least two signals which areobjects of matching; a step of storing one of the two signals as areference signal in a memory, and storing the other of the two signalsas an object signal in the memory; a step of extracting sample points ofthe object signal respectively corresponding to sample points in apredetermined block of the reference signal stored in the memory; and astep of evaluating a difference degree by selectively using a firstarithmetic process of calculating a maximum value of absolute differencevalues between the sample points of the reference signal and the samplepoints of the object signal as an evaluation value and a secondarithmetic process of calculating a sum of the absolute differencevalues between the sample points of the reference signal and the samplepoints of the object signal as the evaluation value; and a step ofsetting a specific mode, wherein the step of evaluating evaluates thedifference degree by selecting the first arithmetic process unit in acase in which the specific mode is set by the mode setting unit, andselecting the second arithmetic process unit in a case in which thespecific mode is not set by the mode setting unit.
 4. A non-transitorycomputer readable recording medium storing a program which causes acomputer to perform functions comprising: a function of acquiring atleast two signals which are objects of matching; a function of storingone of the two signals as a reference signal in a memory, and storingthe other of the two signals as an object signal in the memory; afunction of extracting sample points of the object signal respectivelycorresponding to sample points in a predetermined block of the referencesignal stored in the memory; a function of evaluating a differencedegree by selectively using a first arithmetic process of calculating amaximum value of absolute difference values between the sample points ofthe reference signal and the sample points of the object signal as anevaluation value and a second arithmetic process of calculating a sum ofthe absolute difference values between the sample points of thereference signal and the sample points of the object signal as theevaluation value; and a function of setting a specific mode, wherein thefunction of evaluating evaluates the difference degree by selecting thefirst arithmetic process unit in a case in which the specific mode isset by the mode setting unit, and selecting the second arithmeticprocess unit in a case in which the specific mode is not set by the modesetting unit.
 5. A difference degree evaluation method comprising: astep of acquiring at least two signals which are objects of matching; astep of storing one of the two signals as a reference signal in amemory, and storing the other of the two signals as an object signal inthe memory; a step of extracting sample points of the object signalrespectively corresponding to sample points in a predetermined block ofthe reference signal stored in the memory; a step of evaluating adifference degree by selectively using a first arithmetic process ofcalculating a maximum value of absolute difference values between thesample points of the reference signal and the sample points of theobject signal as an evaluation value and a second arithmetic process ofcalculating a sum of squared difference between the sample points of thereference signal and the sample points of the object signal as theevaluation value; and a step of setting a specific mode, wherein thestep of evaluating evaluates the difference degree by selecting thefirst arithmetic process unit in a case in which the specific mode isset by the mode setting unit, and selecting the second arithmeticprocess unit in a case in which the specific mode is not set by the modesetting unit.
 6. A non-transitory computer readable recording mediumstoring a program which causes a computer to perform functionscomprising: a function of acquiring at least two signals which areobjects of matching; a function of storing one of the two signals as areference signal in a memory, and storing the other of the two signalsas an object signal in the memory; a function of extracting samplepoints of the object signal respectively corresponding to sample pointsin a predetermined block of the reference signal stored in the memory; afunction of evaluating a difference degree by selectively using a firstarithmetic process of calculating a maximum value of absolute differencevalues between the sample points of the reference signal and the samplepoints of the object signal as an evaluation value and a secondarithmetic process of calculating a sum of squared difference betweenthe sample points of the reference signal and the sample points of theobject signal as the evaluation value; and a function of setting aspecific mode, wherein the function of evaluating evaluates thedifference degree by selecting the first arithmetic process unit in acase in which the specific mode is set by the mode setting unit, andselecting the second arithmetic process unit in a case in which thespecific mode is not set by the mode setting unit.